package com.asl.website.sysCompanyInfo.domain;

/**
 * @author 482944566@qq.com
 * @version 1.0
 * @date 2025-05-22
 */

import com.asl.common.utils.StringUtils;
import com.asl.website.common.Language;

/**
 * 企业信息响应DTO
 */
public class CompanyInfoDTO {
    private String profileImage;
    private String companyProfile;
    private String corporateCulture;
    private String companyPosition;
    private String companyVision;
    private String advantages;
    private String language;

    public CompanyInfoDTO(SysCompanyInfo content, String language) {
        this.language = language;
        this.profileImage = content.getProfileImage();

        switch (Language.fromCode(language)) {
            case EN_US:
                this.companyProfile = getContent(content.getCompanyProfileEn(), content.getCompanyProfileZh());
                this.corporateCulture = getContent(content.getCorporateCultureEn(), content.getCorporateCultureZh());
                this.companyPosition = getContent(content.getCompanyPositionEn(), content.getCompanyPositionZh());
                this.companyVision = getContent(content.getCompanyVisionEn(), content.getCompanyVisionZh());
                this.advantages = getContent(content.getAdvantagesEn(), content.getAdvantagesZh());
                break;
            case DE_DE:
                this.companyProfile = getContent(content.getCompanyProfileDe(), content.getCompanyProfileZh());
                this.corporateCulture = getContent(content.getCorporateCultureDe(), content.getCorporateCultureZh());
                this.companyPosition = getContent(content.getCompanyPositionDe(), content.getCompanyPositionZh());
                this.companyVision = getContent(content.getCompanyVisionDe(), content.getCompanyVisionZh());
                this.advantages = getContent(content.getAdvantagesDe(), content.getAdvantagesZh());
                break;
            default: // 默认中文
                this.companyProfile = content.getCompanyProfileZh();
                this.corporateCulture = content.getCorporateCultureZh();
                this.companyPosition = content.getCompanyPositionZh();
                this.companyVision = content.getCompanyVisionZh();
                this.advantages = content.getAdvantagesZh();
        }
    }

    private String getContent(String targetLangContent, String defaultContent) {
        return StringUtils.isNotBlank(targetLangContent) ? targetLangContent : defaultContent;
    }

    // getters
    public String getProfileImage() {
        return profileImage;
    }

    public String getCompanyProfile() {
        return companyProfile;
    }

    public String getCorporateCulture() {
        return corporateCulture;
    }

    public String getCompanyPosition() {
        return companyPosition;
    }

    public String getCompanyVision() {
        return companyVision;
    }

    public String getAdvantages() {
        return advantages;
    }

    public String getLanguage() {
        return language;
    }
}